<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>
<head>

  <meta http-equiv="Content-Language" content="en-us">


  <title>IupGLToggle</title>
  <link rel="stylesheet" type="text/css" href="../../style.css">

  <style type="text/css">
.style1 {
	font-size: large;
}
</style>

  </head>


<body>

<div id="navigation">
  
<ul>

    <li><a href="#Creation">Creation</a></li>

    <li><a href="#Attributes">Attributes</a></li>

    <li><a href="#Callbacks">Callbacks</a></li>

    <li><a href="#Notes">Notes</a></li>

    <li><a href="#Examples">Examples</a></li>

    <li><a href="#SeeAlso">See Also</a></li>

  
</ul>

</div>


<h2>IupGLToggle <span class="style1">(since 3.11)</span></h2>


  
<p>
  Creates an embedded OpenGL toggle interface element. It is a two-state (on/off) button that, when selected, generates an 
  action that activates a function in the associated application. Its visual representation can contain a text 
  and/or an 
  image.&nbsp;It inherits from
<a href="iupglbutton.html">IupGLButton</a>. It exists only inside an
<a href="iupglcanvasbox.html">IupGLCanvasBox</a>.</p>


<h3><a name="Creation">Creation</a></h3>


<pre>Ihandle* IupGLToggle(const char *<strong>title</strong>); [in C]<br>iup.gltoggle{[title = <strong>title</strong>: string]} -&gt; (<strong>elem</strong>: ihandle) [in Lua]<br>gltoggle(<strong>title</strong>) [in LED]</pre>

  
<p><b>
  title</b>: Text to be shown on the toggle. It can be NULL. It will set the 
  TITLE attribute.<br>

    </p>

  
<p>
  <u>Returns:</u> the identifier of the 
  created element, or NULL if an error occurs.</p>


<h3><a name="Attributes">Attributes</a></h3>



<p>The 
  <strong>IupGLToggle</strong> element handle all attributes defined for the
<a href="iupglbutton.html">IupGLButton</a> control, and consequently for the
<a href="iupgllabel.html">IupGLLabel</a> control and for the
<a href="iupglsubcanvas.html">IupGLSubCanvas</a> control too.</p>


<blockquote>
  <hr>
</blockquote>

<p><strong>CHECKMARK</strong> (<font size="3">non inheritable</font>): Enables 
the check mark. Default: NO. When enabled the border and the background are not 
drawn, and a check mark box is drawn at left or right, according to RIGHTBUTTON.</p>

<p><strong>CHECKMARKWIDTH</strong> (<font size="3">non inheritable</font>): Size 
of the check mark. Default: 14.</p>
<p><strong>RADIO</strong> (read-only): returns if the toggle is inside a radio. 
Can be &quot;YES&quot; or &quot;NO&quot;. Valid only after the element is mapped, before returns 
NULL.</p>
<p><strong>IGNORERADIO</strong> (<font size="3">non inheritable</font>): when 
set the toggle will not behave as a radio when inside an <strong>IupRadio</strong> 
hierarchy. (since 3.21)</p>
<p><strong>RIGHTBUTTON</strong> (<font size="3">non inheritable</font>): place 
the check button at the right of the text. Can be &quot;YES&quot; or &quot;NO&quot;. Default: &quot;NO&quot;.</p>

<p><b>VALUE</b> (<font size="3">non inheritable</font>):
  Toggle's state. Values can be "ON",
  "OFF" or &quot;TOGGLE&quot;. 
  Default: "OFF". 
	The TOGGLE option will invert the current state.</p>

  
<h3><a name="Callbacks">Callbacks</a></h3>


<p>The 
  <strong>IupGLToggle</strong> element handle all callbacks defined for the
<strong>IupGLSubCanvas</strong> control.</p>
<blockquote>
  <hr>
</blockquote>


<p><a href="../call/iup_action.html">ACTION</a>:
  Action generated when the toggle's state 
  (on/off) was changed. The callback also receives the toggle's state.</p>

  
    
<pre>int function(Ihandle*<strong> ih</strong>, int <strong>state</strong>); [in C]<br><strong>elem</strong>:action(<strong>state</strong>: number) -&gt; (<strong>ret</strong>: number) [in Lua]</pre>

    
<p class="info"><strong>ih</strong>:
  identifier of the element that activated the 
  event.<br>

    <strong>state</strong>:
    1 if the toggle's state was set to on; 0 if it was set to off.</p>

<p class="info"><u>Returns</u>: IUP_CLOSE will be processed.</p>


<p><strong>VALUECHANGED_CB</strong>: Called after the value was interactively 
changed by the user. Called after the ACTION callback, but under the same 
context.</p>

<pre>int function(Ihandle *<strong>ih</strong>); [in C]<br><strong>elem</strong>:valuechanged_cb() -&gt; (<strong>ret</strong>: number) [in Lua]</pre>

    
<p class="info"><strong>ih</strong>:
  identifier of the element that activated the 
  event.</p>

    

<h3><a name="Notes">Notes</a></h3>


<p><strong>IupGLToggle</strong> visual is the same as a <strong>IupGLButton</strong>. 
There is no check mark.</p>

  
<p>To build a set of mutual exclusive toggles, insert them in a <strong>IupRadio</strong>
container. They must be inserted before creation, and their behavior can not be 
changed. </p>

<p>A toggle that is a child of an <strong>IupRadio</strong> automatically receives a name when 
its is mapped into the native system. 
(since 3.16)</p>


<h3><a name="SeeAlso">See Also</a></h3>


<p><a href="../elem/iupimage.html">IupImage</a>, <a href="iupglbutton.html">IupGLButton</a>,
  <a href="iupgllabel.html">IupGLLabel</a>, <a href="iupradio.html">IupRadio</a>. </p>



</body>
</html>
